﻿using System;
using System.Data;
using System.Collections.Generic;
using FiberRMS.Model.AlarmManager;
namespace FiberRMS.BLL.AlarmManager
{
	/// <summary>
	/// 业务逻辑类ALARM_TRANSMIT 的摘要说明。
	/// </summary>
	public class ALARM_TRANSMIT
	{
		private readonly FiberRMS.DAL.AlarmManager.ALARM_TRANSMIT dal=new FiberRMS.DAL.AlarmManager.ALARM_TRANSMIT();
		public ALARM_TRANSMIT()
		{}
		#region  成员方法
        public int GetMaxID()
        { return dal.GetMaxID(); }
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string ALARMTRANSMITID)
		{
			return dal.Exists(ALARMTRANSMITID);
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public void Add(FiberRMS.Model.AlarmManager.ALARM_TRANSMIT model)
		{
			dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public void Update(FiberRMS.Model.AlarmManager.ALARM_TRANSMIT model)
		{
			dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public void Delete(string ALARMTRANSMITID)
		{
			
			dal.Delete(ALARMTRANSMITID);
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public FiberRMS.Model.AlarmManager.ALARM_TRANSMIT GetModel(string ALARMTRANSMITID)
		{
			
			return dal.GetModel(ALARMTRANSMITID);
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<FiberRMS.Model.AlarmManager.ALARM_TRANSMIT> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			List<FiberRMS.Model.AlarmManager.ALARM_TRANSMIT> modelList = new List<FiberRMS.Model.AlarmManager.ALARM_TRANSMIT>();
			int rowsCount = ds.Tables[0].Rows.Count;
			if (rowsCount > 0)
			{
				FiberRMS.Model.AlarmManager.ALARM_TRANSMIT model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new FiberRMS.Model.AlarmManager.ALARM_TRANSMIT();
					model.ALARMTRANSMITID=ds.Tables[0].Rows[n]["ALARMTRANSMITID"].ToString();
					if(ds.Tables[0].Rows[n]["STARTTIME"].ToString()!="")
					{
						model.STARTTIME=DateTime.Parse(ds.Tables[0].Rows[n]["STARTTIME"].ToString());
					}
					if(ds.Tables[0].Rows[n]["ENDTIME"].ToString()!="")
					{
						model.ENDTIME=DateTime.Parse(ds.Tables[0].Rows[n]["ENDTIME"].ToString());
					}
					model.TRANSMITMETHOD=ds.Tables[0].Rows[n]["TRANSMITMETHOD"].ToString();
					model.ISUSE=ds.Tables[0].Rows[n]["ISUSE"].ToString();
					model.ALARMTRANSNAME=ds.Tables[0].Rows[n]["ALARMTRANSNAME"].ToString();
					model.ALARMMAPIDS=ds.Tables[0].Rows[n]["ALARMMAPIDS"].ToString();
					model.USERS=ds.Tables[0].Rows[n]["USERS"].ToString();
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}
        /// <summary>
        /// 获得子系统名称
        /// </summary>
        /// <param name="codeid"></param>
        /// <param name="codevalue"></param>
        /// <param name="table"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public DataSet getCommCode(string codeid, string codevalue, string table, string value)
        {
            return dal.getCommCode(codeid, codevalue, table, value);
        }
        public DataSet getCommCode_Order(string codeid, string codevalue, string table, string value,string order)
        {
            return dal.getCommCode_Order(codeid, codevalue, table, value, order);
        }
		/// <summary>
		/// 获得数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  成员方法
	}
}



